<template>
  <section class="body">
    <div class="body-top">
      <router-link tag="div" :to="{ name: 'citys' }" class="left" @click.native="changename">
        北京
        <i class="fa fa-angle-down"></i>
      </router-link>
      <div class="centre">
        <div :class="{ active: isActive }" @click="toggle">正在热映</div>
        <div :class="{ active: !isActive }" @click="toggle">即将上映</div>
      </div>
      <div class="right">
        <i class="fa fa-search"></i>
      </div>
    </div>
    <div class="body-bottom">
      <component :is="template"></component>
    </div>

    <app-footer></app-footer>
  </section>
</template>

<script>
import AppMovieAbout from "@pages/movie/AppMovieAbout";
import AppMovieBeing from "@pages/movie/AppMovieBeing";
import AppFooter from "@com/layout/AppFooter";

import Bus from "@util/bus";
export default {
  data() {
    return {
      isActive: true,
      template: AppMovieBeing
    };
  },
  components: {
    AppMovieAbout,
    AppMovieBeing,
    AppFooter
  },
  methods: {
    toggle() {
      this.isActive = !this.isActive;
      this.template =
        this.template == AppMovieBeing ? AppMovieAbout : AppMovieBeing;
    },
    changename() {
      Bus.$emit("changename", '当前城市');
    }
  }
};
</script>

<style lang="scss">
.body {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;

  .body-top {
    display: flex;
    align-items: center;
    height: 1.173333rem;
    justify-content: space-between;
    background-color: #fff;
    border-bottom: 1px solid #999999;

    .left {
      padding-left: 0.4rem;
      font-size: 0.4rem;
      color: #666;
      display: flex;
      align-items: center;
      width: 4rem;

      i {
        padding-left: 0.08rem;
      }
    }

    .right {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      width: 2.666667rem;
      padding: 0.133333rem 0.2rem 0.133333rem 0.133333rem;
      font-size: 0.186667rem;
      font-size: 0.4rem;
    }

    .centre {
      display: flex;
      justify-content: space-between;
      align-items: center;

      div {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0 0.133333rem;
        color: #ef4238;
      }

      .active {
        border-bottom: 2px solid #ef4238;
      }
    }
  }
}
</style>
